home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / raytrace / renaisnc / rcnstrct.lha / Reconstruct / Reconstruct.h < prev   
Encoding:
C/C++ Source or Header  |  1992-01-04  |  2.4 KB  |  89 lines

  1. /* -----------------------------------
  2.    Define the maximum depth we will 
  3.    allow the tree to grow to.
  4.   ------------------------------------*/
  5. #define MAX_DEPTH 512
  6.  
  7.  
  8. /* ------------------------------------
  9.    Define the maximum number of samples
  10.    that can contribute to a pixel value
  11.    ------------------------------------*/
  12. #define MAX_SAMPLES 10000
  13.  
  14.  
  15. /* -----------------------------------
  16.   a node is a leaf node if it is null or
  17.   both its children are null 
  18.   ------------------------------------*/
  19.  
  20. #define IsLeaf(LNODE)  ((LNODE == NULL) || \
  21. ((LNODE->Left == NULL) && (LNODE->Right == NULL))  \
  22. ? 1 : 0)
  23.  
  24.  
  25. /*------------------------------------
  26.   a node is an internal node if its is 
  27.   not a leaf node
  28.   ----------------------------------*/
  29.  
  30. #define IsInternal(INODE)  ( ( IsLeaf(INODE) ) ? 0 : 1)
  31.  
  32.  
  33. /*------------------------------------
  34.   a node is a leaf parent if it is not a
  35.   leaf but one of its child nodes is
  36.   ----------------------------------*/
  37. #define IsLeafParent(INODE) \
  38.   ((!IsLeaf(INODE)) && ( (IsLeaf(INODE->Right)) || (IsLeaf(INODE->Left)) ))
  39.  
  40.  
  41. /*---------------------------------
  42.   choose a subnode to refine
  43.   --------------------------------*/
  44. #define ChooseSubNode(NODE)  ((NODE->Direction == GOLEFT) ? NODE->Left : NODE->Right)
  45.  
  46.  
  47. /*---------------------------------
  48.   choose the other node 
  49.   --------------------------------*/
  50. #define ChooseOtherNode(PARENT,ONODE) (PARENT->Left == ONODE) \
  51. ? PARENT->Right : PARENT->Left
  52.  
  53.  
  54. #define fabs(a)  ( ((a) > 0) ? (a) : -(a) )
  55. #define min(a,b) ( ((a) < (b)) ? a : b )
  56. #define max(a,b) ( ((a) < (b)) ? b : a )
  57.  
  58.  
  59. /*****************************************************************************
  60.         the structure of a node in the hierachical tree
  61.  ****************************************************************************/
  62. typedef struct Rectangle {
  63.   float xL, xH, yL, yH;
  64. } RectType;
  65.  
  66. typedef struct  { float r,g,b,a; } FloatColor;
  67.  
  68. typedef struct {
  69.   float Xs, Ys;
  70.   FloatColor Ave;
  71. } SampleData;
  72.  
  73.  
  74. typedef struct hierarchical_region HierarchicalRegion;
  75. struct hierarchical_region {
  76.   HierarchicalRegion *Left;    /* left child                           */
  77.   HierarchicalRegion *Right;    /* right child                          */
  78.   SampleData *Sample;        /* Sample value */
  79.   float splitValue;
  80.   unsigned splitDirection : 1;  /* split direction: 0 Vertical; 1 Horizontal */
  81. };
  82.  
  83.  
  84.  
  85. /*
  86.  *  Enumeration type for the filter kernel function type
  87.  */
  88. typedef enum { Gaussian, Sinc, WindowedSinc, Cubic } FilterFunctionType;
  89.